home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 009a / tde221.zip / CFGMACRO.C < prev    next >
C/C++ Source or Header  |  1993-04-01  |  2KB  |  84 lines

  1. /*
  2.  * This module contains all the routines needed to save an existing macro
  3.  * definition file in tde.exe
  4.  *
  5.  * Program Name:  tdecfg
  6.  * Author:        Frank Davis
  7.  * Date:          October 5, 1991
  8.  */
  9.  
  10. #include <io.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. #include "tdecfg.h"
  16. #include "cfgmacro.h"
  17.  
  18. extern struct vcfg cfg;
  19. extern FILE *tde_exe;                  /* FILE pointer to tde.exe */
  20.  
  21. static WINDOW *w_ptr;
  22.  
  23. MACRO macros;
  24.  
  25. /********    EXTREMELY IMPORTANT   ************/
  26. /*
  27.  * If you modify tde, it is your responsibility to find the offset of
  28.  * the macro buffer in your new executable, tde.exe.
  29.  *
  30.  */
  31.  
  32.  
  33.  
  34. /*
  35.  * Name:    tdehelp
  36.  * Date:    October 1, 1991
  37.  * Notes:   Set up most of the window global variables.
  38.  */
  39. void tdemacro( void )
  40. {
  41. int c;
  42. char fname[82];
  43. FILE *macro_file;                  /* FILE pointer to macro */
  44.  
  45.  
  46.    cls( );
  47.    show_box( 0, 0, macro_screen, NORMAL );
  48.    xygoto( 42, 14 );
  49.    c = getkey( );
  50.    while (c != '1' && c != '2')
  51.       c = getkey( );
  52.    if (c == '1') {
  53.       puts( "" );
  54.       puts( "" );
  55.       puts( "" );
  56.       puts( "Enter file name that contains the macro definitions :" );
  57.       gets( fname );
  58.       if ((c = access( fname, EXIST )) != 0) {
  59.          puts( "\nFile not found.  Press any key to continue." );
  60.          c = getkey( );
  61.          cls( );
  62.          return;
  63.       } else if ((macro_file = fopen( fname, "rb" )) == NULL ) {
  64.          puts( "\nCannot open macro file.  Press any key to contine." );
  65.          c = getkey( );
  66.          cls( );
  67.          return;
  68.       }
  69.  
  70.       fread( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, macro_file );
  71.       fread( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, macro_file );
  72.       fseek( tde_exe, MACRO_OFFSET + 8, SEEK_SET );
  73.       fwrite( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, tde_exe );
  74.       fwrite( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, tde_exe );
  75.       fclose( macro_file );
  76.       puts( "" );
  77.       puts( "" );
  78.       puts( "" );
  79.       puts( "New macros successfully installed.  Press any key to continue." );
  80.       c = getkey( );
  81.    }
  82.    cls( );
  83. }
  84.